import {createRouter, createWebHistory} from 'vue-router'
import RouteInfo from "@/router/route-info.js";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect() {
        return RouteInfo.login.path;
      }
    },
    {
      path: RouteInfo.login.path,
      name: RouteInfo.login.name,
      component: import('@/views/login/Login.vue'),
      meta: {title: RouteInfo.login.title}
    },
    {
      path: '/layout',
      name: 'layout',
      component: import('@/layout/Layout.vue'),
      children: [
        {
          path: RouteInfo.home.path,
          name: RouteInfo.home.name,
          component: import('@/views/home/Home.vue'),
          meta: {title: RouteInfo.home.title}
        },
      ]
    },
  ],
})

export default router
